/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wudt;

import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author jzajaczek
 */
@ManagedBean
@SessionScoped
public class Controller {
 
    /**
     * Creates a new instance of Controller
     */
    public Controller() {
    }

    private String activeIndex = "1,2,3";
    private boolean tabProjectDescriptionActive = false;
    private boolean tabMediumDataActive = false;
    private boolean tabGasketDataActive = false; 
    private boolean tabFlangeDataActive = false;     
    private boolean tabFlangeDataDisable = false;
    
    private int workCondNo = 0;
    private String name;
    
    private int resultSplitPos = 300;
    
    public String activeIndex(String projectActive) {
        return activeIndex;
    }
    
    public String getActiveIndex() {
        String tx = "";
        String ar[] = {"", "", "", ""};
        if (this.tabProjectDescriptionActive) {
            ar[0] = "0";
        }
        if (this.tabMediumDataActive) {
            ar[1] = "1";
        }
        if (this.tabGasketDataActive) {
            ar[2] = "2";
        }
        if (this.tabFlangeDataActive) {
            ar[3] = "3";
        }
        for (int i = 0; i <= ar.length; i++) {
            tx = "0,1,2,3";
        }
        return tx;
    }    
    
    public boolean flangeDisableChange() {
        return ! this.getTabFlangeDataDisable();
    }
   
    public void workCondAdd() {
        lg.add(new Gasket(workCondNo+1));
        workCondNo = lg.size();
        
    }
    
    public void workCondRemove(int i) {
        lg.remove(i);
    }
    
    public int workConSize() {
        return lg.size();
    }
    
    public List<Gasket> lg = new ArrayList<>();

    /**
     * @return the workCondNo
     */
    public int getWorkCondNo() {
        return workCondNo;
    }

    /**
     * @param workCondNo the workCondNo to set
     */
    public void setWorkCondNo(int workCondNo) {
        this.workCondNo = workCondNo;
    }

    public int getResultSplitPos() {
        return resultSplitPos;
    }

    public void setResultSplitPos(int resultSplitPos) {
        this.resultSplitPos = resultSplitPos;
    }

    public boolean getTabFlangeDataDisable() {
        return tabFlangeDataDisable;
    }

    public void setTabFlangeDataDisable(boolean tabFlangeDataDisable) {
        this.tabFlangeDataDisable = tabFlangeDataDisable;
    }

    public void setActiveIndex(String activeIndex) {
        this.activeIndex = activeIndex;
    }

    public boolean isProjectActive() {
        return tabProjectDescriptionActive;
    }

    public void setTabProjectDescriptionActive(boolean tabProjectDescriptionActive) {
        this.tabProjectDescriptionActive = tabProjectDescriptionActive;
    }

    public boolean isTabGasketDataActive() {
        return tabGasketDataActive;
    }

    public void setTabGasketDataActive(boolean tabGasketDataActive) {
        this.tabGasketDataActive = tabGasketDataActive;
    }

    public boolean isTabFlangeDataActive() {
        return tabFlangeDataActive;
    }

    public void setTabFlangeDataActive(boolean tabFlangeDataActive) {
        this.tabFlangeDataActive = tabFlangeDataActive;
    }

    public boolean isTabMediumDataActive() {
        return tabMediumDataActive;
    }

    public void setTabMediumDataActive(boolean tabMediumDataActive) {
        this.tabMediumDataActive = tabMediumDataActive;
    }
}